package com.hmall.common.interceptor;

import com.hmall.common.entry.BaseContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Component
public class MyFeignInterceptor implements RequestInterceptor{

    @Override
    public void apply(RequestTemplate template) {

        log.info("===request: {}", template.url());
        BaseContext.setCurrentId(2L);
        template.header("authorization", BaseContext.getCurrentId().toString());

    }

}